package org.apache.beam.examples.Models;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;


/**
 * 数据对象检查主体的对象配置
 */
public class QualityRuleMainModel implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private String qualityId;
    /**
     * 规则名称
     */
    private String qualityName;
    /**
     * 规则说明
     */
    private String qualityDescription;
    /**
     * 规则表名称
     */
    private String qualityMainTableName;
    /**
     * 规则的具体内容
     */
    private List<QualityRuleDetailModel> qualityRuleDetailModels;

    public QualityRuleMainModel() {
        qualityRuleDetailModels = new ArrayList<>();
    }

    public List<QualityRuleDetailModel> getQualityRuleDetailModels() {
        return qualityRuleDetailModels;
    }

    public void setQualityRuleDetailModels(List<QualityRuleDetailModel> qualityRuleDetailModels) {
        this.qualityRuleDetailModels = qualityRuleDetailModels;
    }

    public void addQualityRuleDetailModel(QualityRuleDetailModel qualityRuleDetailModel) {
        qualityRuleDetailModels.add(qualityRuleDetailModel);
    }


    public QualityRuleMainModel(String qualityId, String qualityName, String qualityDescription, String qualityMainTableName, List<QualityRuleDetailModel> qualityRuleDetailModels) {
        this.qualityId = qualityId;
        this.qualityName = qualityName;
        this.qualityDescription = qualityDescription;
        this.qualityMainTableName = qualityMainTableName;
        this.qualityRuleDetailModels = qualityRuleDetailModels;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", QualityRuleMainModel.class.getSimpleName() + "[", "]")
                .add("qualityId='" + qualityId + "'")
                .add("qualityName='" + qualityName + "'")
                .add("qualityDescription='" + qualityDescription + "'")
                .add("qualityMainTableName='" + qualityMainTableName + "'")
                .add("qualityRuleDetailModels=" + qualityRuleDetailModels)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        QualityRuleMainModel that = (QualityRuleMainModel) o;
        return Objects.equals(getQualityId(), that.getQualityId()) && Objects.equals(getQualityName(), that.getQualityName()) && Objects.equals(getQualityDescription(), that.getQualityDescription()) && Objects.equals(getQualityMainTableName(), that.getQualityMainTableName()) && Objects.equals(getQualityRuleDetailModels(), that.getQualityRuleDetailModels());
    }

    @Override
    public int hashCode() {
        int result = Objects.hashCode(getQualityId());
        result = 31 * result + Objects.hashCode(getQualityName());
        result = 31 * result + Objects.hashCode(getQualityDescription());
        result = 31 * result + Objects.hashCode(getQualityMainTableName());
        result = 31 * result + Objects.hashCode(getQualityRuleDetailModels());
        return result;
    }

    public String getQualityId() {
        return qualityId;
    }

    public void setQualityId(String qualityId) {
        this.qualityId = qualityId;
    }

    public String getQualityName() {
        return qualityName;
    }

    public void setQualityName(String qualityName) {
        this.qualityName = qualityName;
    }

    public String getQualityDescription() {
        return qualityDescription;
    }

    public void setQualityDescription(String qualityDescription) {
        this.qualityDescription = qualityDescription;
    }

    public String getQualityMainTableName() {
        return qualityMainTableName;
    }

    public void setQualityMainTableName(String qualityMainTableName) {
        this.qualityMainTableName = qualityMainTableName;
    }
}
